/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2019-2024. All rights reserved.
 */
package com.ccys.common.third.push.huawei.push.util;




import com.ccys.common.third.push.huawei.push.messaging.HuaweiApp;
import com.ccys.common.third.push.huawei.push.messaging.HuaweiCredential;
import com.ccys.common.third.push.huawei.push.messaging.HuaweiOption;


public class InitAppUtils {
    /**
     * @return HuaweiApp
     */
    public static HuaweiApp initializeApp() {
//        String appId = "101314719";
//        String appSecret = "b1a6df512b52c043d82bf979c4fec4fccc2a5a683d493b61c6ebe21272f7567e";
        String appId = "104955689";
        String appSecret = "6c4989112e867886f56717155772a16c44993f8220617bd5ab4b7e82d7621eb0";
        // Create HuaweiCredential
        // This appId and appSecret come from Huawei Developer Alliance
        return initializeApp(appId, appSecret);
    }

    private static HuaweiApp initializeApp(String appId, String appSecret) {
        HuaweiCredential credential = HuaweiCredential.builder()
                .setAppId(appId)
                .setAppSecret(appSecret)
                .build();

        // Create HuaweiOption
        HuaweiOption option = HuaweiOption.builder()
                .setCredential(credential)
                .build();

        // Initialize HuaweiApp
//        return HuaweiApp.initializeApp(option);
        return HuaweiApp.getInstance(option);
    }
}
